<template>
    <u-navbar :placeholder="true" :bgColor="bgColor" color="#000000">
        <!-- #ifdef MP-WEIXIN -->
        <view class="u-nav-slot" slot="left">
            <u-icon
                v-if="left == 'back'"
                name="arrow-left"
                size="32"
                :blod="true"
                label="返回"
                @click="goBack"
                :color="fontColor"
                :labelColor="fontColor"
            ></u-icon>
            <u-icon
                v-if="left == 'home'"
                name="home"
                size="32"
                :blod="true"
                label="首页"
                @click="goHome"
                :color="fontColor"
                :labelColor="fontColor"
            ></u-icon>
        </view>
        <!-- #endif -->
<!--         #ifdef MP-ALIPAY -->
        <view class="u-nav-slot" slot="left">
          <u-icon
              v-if="left == 'back'"
              name="arrow-left"
              size="34"
              :blod="true"
              :label="BackLabelText"
              @click="goBack"
              :color="fontColor"
              :labelColor="fontColor"
          ></u-icon>
          <u-icon
              v-if="left == 'home'"
              name="home"
              size="34"
              :blod="true"
              label="首页"
              @click="goHome"
              :color="fontColor"
              :labelColor="fontColor"
          ></u-icon>
        </view>
<!--         #endif-->
        <view class="u-nav-slot" slot="center">
            <view class="title" :style="{ color: fontColor }">
                {{ title }}
            </view>
        </view>
    </u-navbar>
</template>
<script>
export default {
    props: {
        title: {
            type: String,
            default() {
                return "";
            },
        },
        bgColor: {
            type: String,
            default() {
                return "#fff";
            },
        },
        fontColor: {
            type: String,
            default() {
                return "#000000";
            },
        },
        left: {
            type: [String,Boolean],
            default() {
                return "back";
            },
        },
        hideBackLabelText: {
          type: Boolean,
          default : false
        }
    },
    computed: {
      BackLabelText() {
        return this.hideBackLabelText ? "" : "返回"
      }
    },
    methods: {
        goBack() {
            uni.navigateBack({
                delta: 1,
            });
        },
        goHome() {
            uni.redirectTo({ url: "/pages/home/index",
              success(e){
                // uni.$emit('reloadPageData',{})
              }
            });
        },
    },
};
</script>
<style lang="scss">
.title {
    font-size: 36rpx;
}
</style>
